package com.zhazha.stand.mapper;

import java.util.List;

import com.zhazha.stand.entity.Department;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Update;


public interface DepartmentMapper {

	
	public Department getById(int id);
	
	
	public Department getByName(String name);
	
	public List<Department> getList();
	
	@Update("UPDATE departments set name=#{name} where id=#{id}")
	public void update(Department department);
	
	@Options(flushCache=true)
	public boolean insert(String name);
	
	@Delete("DELETE FROM departments WHERE id=#{id}")
	@Options(flushCache=true)
	public void delete(int id);
	
	@Delete("DELETE FROM departments WHERE name=#{name}")
	@Options(flushCache=true)
	public void deleteByName(String name);
	
	@Delete("DELETE FROM departments")
	@Options(flushCache=true)
	public void clear();
}
